package com.jh.paymentchannel;

import cn.jh.common.pay.client.FreeQuickClient;
import cn.jh.common.pay.client.FreeQuickRequest;
import cn.jh.common.pay.client.FreeQuickResponse;
import cn.jh.common.pay.enumtype.EncryptTypeEnum;
import cn.jh.common.utils.CommonConstants;
import org.junit.jupiter.api.Test;


public class DfWithDraw {
    @Test
    void widthdraw() throws Exception{
//       String url="http://47.107.104.250:8099/rest/v1.0/paybar/withdrawDeposit";
        FreeQuickRequest request = new FreeQuickRequest(CommonConstants.AGENT_NO, CommonConstants.AGENT_KEY);
        request.setSupportSign(false);
        request.setEncryptType(EncryptTypeEnum.AES);
        request.addParam("requestNo", String.valueOf(System.currentTimeMillis()));//请求流水号
        request.addParam("merchantNo", "1539063688534");//商户编号1318092101033417
        request.addParam("channelCode", "CHANPAYNEWCARD");//渠道编码
        request.addParam("bankAccountNo", "6236681420012350039");//银行账号
        request.addParam("bankAccountName", "夏恩衍");//银行账户名
        request.addParam("bankAccountType", CommonConstants.PRIVATE);//账户类型
        request.addParam("bankName", "建设银行");//银行名称
        request.addParam("bankSubName", "建设银行股份有限公司上海市淮海中路支行");//支行名称
        request.addParam("bankChannelNo", "105100000017");// 银行行联号
        request.addParam("bankCode", "105");//银行代码
        request.addParam("bankAbbr", "CCB");//银行代号
        request.addParam("bankProvince", "上海市");//银行所属省
        request.addParam("bankCity", "上海市");//银行所属市
        request.addParam("bankArea", "上海市");//银行所属区域
        request.addParam("walletType", CommonConstants.TODAY);//钱包类型
        request.addParam("amount", "1.00");//提现金额提现时把提现手续费加入，因为交易时候扣除了交易手续费，在用户提现时商户需要获得提现，到账记录必须是完整；
        request.addParam("serverCallbackUrl", CommonConstants.BASEURL_XJF + CommonConstants.BASEURL_WITHDRAW_BACK);//提现回调地址

        System.out.println("request:" + request.toString());
        FreeQuickResponse response = FreeQuickClient.post(CommonConstants.BASEURL_WITHDRAW,request);
        System.out.println("response:"+response);
    }
}
